#include <iostream>
using namespace std;
static int some = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    return 0;
}();

/*
Determine whether an integer is a palindrome. Do this without extra space.
*/
class Solution
{
  public:
    bool isPalindrome(int x)
    {
        if (x < 0 || (x != 0 && x % 10 == 0))
            return false;

        auto low = 0;

        while (x > low)
        {
            low = low * 10 + x % 10;
            x = x / 10;
        }

        return x == low || x == low / 10;
    }
};